from py_page.base_page import BasePage
from common.log import logger


class LoginPage(BasePage):
    # yaml_path = r"D:\PythonCoding\需要敲代码框架\32\WebUIFram\py_yaml\login_page.yaml"
    yaml_path = BasePage.get_yaml_path("login_page.yaml")

    def use_right_account_pwd_login(self, tel):
        # print("使用正确的账号密码进行登录，跳转回首页")

        # # 在登陆页面点击  账号密码登录按钮
        # self.driver.find_element(By.XPATH, '//div[contains(text(),"账号密码登录")]').click()
        # time.sleep(3)
        # # 在登录页输入账号
        # self.driver.find_element(By.XPATH, '//input[@placeholder="请输入账号/手机号码"]').send_keys("13012312300")
        # # 在登录页输入密码
        # self.driver.find_element(By.XPATH, '//input[@placeholder="请输入密码"]').send_keys("123456.")
        # # 在登录页点击立即登录按钮
        # self.driver.find_element(By.XPATH, '//a[text()="忘记密码？"]//following::span[text()="立即登录"]').click()

        # self.find_and_click("XPATH", '//div[contains(text(),"账号密码登录")]')
        # self.find_and_send("XPATH", '//input[@placeholder="请输入账号/手机号码"]', "13012312300")
        # self.find_and_send("XPATH", '//input[@placeholder="请输入密码"]', "123456.")
        # self.find_and_click("XPATH", '//a[text()="忘记密码？"]//following::span[text()="立即登录"]')

        data = self.run_steps(self.yaml_path, "use_right_account_pwd_login", tel=tel)
        logger.info(f"在登录进行账号密码登录，输入的账号是 13012312300  密码123456.")
        logger.info("【---跳转到首页---】")
        from py_page.main_page import MainPage
        return MainPage(self.driver)


if __name__ == '__main__':
    pass



